Skip to content

[16.0][ADD] rental_base_extension, sale_rental_extension#857

Merged
eantones merged 32 commits into16.0from
16.0-add-rental_base_extension
Mar 23, 2026
Merged

[16.0][ADD] rental_base_extension, sale_rental_extension#857
eantones merged 32 commits into16.0from
16.0-add-rental_base_extension

Conversation

@eantones
Copy link
Copy Markdown
Member

@eantones eantones commented Mar 5, 2026

Summary

rental_base_extension

  • Move Rental Positions menu from Configuration (debug-only) to top-level Rentals menu, visible to all sales users
  • Filter product dropdown on rental order lines to only show rental products (those with rented_product_id set)
  • Catalan and Spanish translations

sale_rental_extension

  • Kanban and calendar views for rental positions with state badges, partner avatar with image zoom on hover
  • "Today" filter and state searchpanel
  • Configurable rental signature terms per company (Settings → Rental → Signature) — Supersedes [16.0][ADD] stock_picking_signature #858
  • Custom signature dialog with "Confirm & Sign" button on rental delivery orders
  • SCSS fix to prevent zoom popup flickering
  • Catalan and Spanish translations

@eantones eantones changed the title [WIP][16.0][ADD] rental_base_extension [16.0][ADD] rental_base_extension Mar 5, 2026
@eantones eantones force-pushed the 16.0-add-rental_base_extension branch from 97f1de6 to 8845385 Compare March 5, 2026 23:41
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 74.24242% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.27%. Comparing base (8114287) to head (57eb060).
⚠️ Report is 33 commits behind head on 16.0.

Files with missing lines Patch % Lines
sale_rental_extension/models/sale_order.py 54.16% 42 Missing and 2 partials ⚠️
sale_rental_extension/models/stock_picking.py 53.33% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             16.0     #857      +/-   ##
==========================================
+ Coverage   43.15%   44.27%   +1.11%     
==========================================
  Files         302      310       +8     
  Lines        6029     6227     +198     
  Branches      965      989      +24     
==========================================
+ Hits         2602     2757     +155     
- Misses       3414     3449      +35     
- Partials       13       21       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eantones eantones force-pushed the 16.0-add-rental_base_extension branch 6 times, most recently from f01de84 to f0f7cff Compare March 6, 2026 08:30
eantones added 6 commits March 9, 2026 22:38
Move Rental Positions screen from Configuration/Debug to the top-level
Rentals menu, making it accessible to all sales users without needing
debug mode.
…lines

Restrict the product selector on sale order lines to only show rental
service products (those linked to a rented product via rented_product_id),
preventing users from accidentally selecting non-rental products when
creating rental orders.
Provide complete ca.po and es.po translations covering all field labels,
menus, messages and help texts for the rental_base module.
Add kanban and calendar views for rental positions with state badges,
partner avatar with image zoom on hover, "Today" filter and state
searchpanel. Include SCSS fix to prevent zoom popup flickering by
disabling pointer-events on the popover overlay.
…liveries

Add configurable rental signature terms on company level with a settings
page (Settings → Rental → Signature). Patch the signature widget to show
a custom dialog with the configured terms rendered as HTML and a
"Confirm & Sign" button when signing rental delivery orders. Add
is_rental_picking computed field on stock.picking to detect rental
deliveries.
Provide ca.po and es.po translations covering field labels, view titles,
signature dialog text and settings descriptions for the module.
@eantones eantones force-pushed the 16.0-add-rental_base_extension branch from f0f7cff to c242574 Compare March 9, 2026 21:57
@eantones eantones changed the title [16.0][ADD] rental_base_extension [16.0][ADD] rental_base_extension, sale_rental_extension Mar 9, 2026
eantones added 6 commits March 9, 2026 23:02
Allow grouping rental positions by rented product in the search view,
making it easier to see all rentals for a specific product at a glance.
The rental checkbox only applies to stockable products (physical items
that can be rented out). Hide it on service products where it has no
effect — rental services are identified by their rented_product_id link,
not by this boolean.
…ervice

Only show the "Create Rental Service" button on product forms when the
product is stockable and has the "Can be Rented" checkbox enabled. This
enforces a clear workflow: first mark the product as rentable, then
create the rental service.
…section

Move rental-related fields (rented_product_id, rental_service_ids,
rental_service_tmpl_ids and "Create Rental Service" button) out of the
Sale group into a new "Rentals" group section on both product.product
and product.template forms.

The original fields in the sale group are hidden with invisible="1" and
the new section is only visible on stockable products that have the
"Can be Rented" flag enabled. On the template form the section also
hides when there are multiple variants (product_variant_count > 1).
…ns and add translations

Hide the entire "Can be Rented" wrapper div (field + label) on service
products by targeting the parent div with an XPath predicate. The Odoo
16 form renderer does not evaluate attrs modifiers on standalone <label>
elements in the options area, so hiding only the field left the label
text visible.

Split the Rentals section into two groups: "Rental" (singular) for
service products showing the related rented product, and "Rentals"
(plural) for stockable products showing the rental services grid and
the "Create Rental Service" button. Add colspan="2" to the service
fields for full-width display.

Add Catalan and Spanish translations for the new group titles, button
text and merge source references for existing "Rental"/"Rentals"
entries to avoid PO duplicates.
Remove the sale order form view that inherited from rental_base and
the menu item that moved Rental Positions to the top-level menu:

- Delete sale_views.xml: the product domain filter on order lines is
  now handled by the dedicated rental form in sale_rental_extension,
  and the Rental Positions menu stays in its original location
  (Configuration) as defined by rental_base
- Update manifest to remove the deleted file
- Update summary to reflect current scope (product form only)
@eantones eantones force-pushed the 16.0-add-rental_base_extension branch from b78bb8a to affbd5e Compare March 16, 2026 23:47
…racking

Create a complete set of dedicated views for rental orders, following
the same architecture as Odoo Enterprise's sale_renting module. This
cleanly separates rental views from the standard sale order views.

Deactivate rental_base's 5 inherited views that modified the standard
sale order form, restoring it to its original state. Also deactivate
sale_rental's menu item from the Sale app and rental_base's separate
Quotations/Orders menus (redundant with our unified Orders view).

New computed fields on sale.order:
- rental_status: lifecycle tracking (Quotation, Quotation Sent,
  Reserved, Pickedup, Returned, Cancelled) computed from the
  linked sale.rental record states
- is_rental_order: True if any order line is a rental
- next_action_date: pickup or return date depending on status
- is_late: True when next_action_date is past due
- rental_duration: days between start and end dates

Dedicated views (all standalone, not inheriting standard sale views):
- Form (mode=primary): rental status badge at top-right using raw
  Bootstrap divs (Enterprise-style), with late pickup/return variants
  in red. Rental period daterange, duration, Update Times button,
  product filter for rental products only, inline editable order lines
  with product_uom_qty hidden when rental
- Tree: Order, Customer, Total (bold, blue when to invoice), Status
  badge with color coding per state
- Kanban: customer name + amount at top, SO number + next action date
  with late warning below, status badge and customer avatar at bottom,
  flexbox layout to anchor bottom row regardless of content height
- Search: My Orders, Rentals, To Do Today, To Pickup, To Return, Late
  filters (Today + Pickup/Return separated for AND logic), Pickup/Return
  date filters, Group By status/salesperson/customer, dual searchpanel
  (rental status + invoice status with fa-retweet icon)

Menu structure (Enterprise-style):
- Rentals > Orders > Orders / To Do Today > Pickup / Return

Catalan and Spanish translations for all new strings.
@eantones eantones force-pushed the 16.0-add-rental_base_extension branch from affbd5e to e815f22 Compare March 16, 2026 23:51
Fix critical bug where sale.order state 'done' was not in the
rental_status selection, causing a ValueError on confirmed orders.
The compute now explicitly handles 'sale' and 'done' states for
rental logic, and maps 'draft', 'sent', 'cancel' directly.

Rework the color scheme to be intuitive and consistent across all
views (tree, kanban, form):
- draft/sent: muted/light (grey — not started)
- pickup (Reserved): info (blue — waiting for action)
- return (Pickedup): warning (yellow — equipment out, needs return)
- returned: success (green — cycle complete)
- cancel: danger (red — negative)
- late: danger indicator (separate from state)

Form badges now use pure states without mixing in the late condition.
Late shows as a separate red badge. Badges only appear when
state is 'sale' or 'done' (draft/sent/cancel use the statusbar).

Kanban cards now show the next action date with the action label
(Pickup: date, Return: date) instead of repeating the state name.
Warning icon with spacing for late orders.

Add calendar view with rental period (start_date to end_date)
colored by rental_status.

Fix stock_picking.py: add missing @api.depends on computed field,
add null check on sale_id before accessing type_id.

Update ca/es translations for new strings.
@eantones eantones force-pushed the 16.0-add-rental_base_extension branch 2 times, most recently from ca4c811 to 49b1d3d Compare March 17, 2026 13:39
The _compute_is_rental_order method only checked order_line.rental,
which is a computed field from product_id.rental (product template).
When a rental service product's template did not have rental=True,
the order was not recognized as a rental order and rental_status
was never computed, even though sale.rental records and stock moves
existed correctly.

Now also checks order_line.rental_type so orders with rental lines
are always detected regardless of the product's rental flag.

Additionally, _compute_rental_status now handles the case where
rental_ids is empty on a confirmed order (e.g. product missing
rented_product_id) by defaulting to "pickup" instead of "returned".

Add tests covering the full rental status lifecycle (draft, pickup,
return, returned, cancel), the product without rental flag scenario,
and the empty rental_ids scenario.
@eantones eantones force-pushed the 16.0-add-rental_base_extension branch from 49b1d3d to a77a1ba Compare March 17, 2026 13:41
eantones added 17 commits March 17, 2026 15:59
Show "Rental" section on service products when rental=False.
Show "Rentals" section on non-service products regardless of
rental checkbox. Always show "Can be Rented" checkbox.
Add Pickup and Return buttons on the rental order form that
navigate directly to the corresponding stock picking via
sale.rental positions. Buttons only appear when a picking
exists. Disable inline editable mode on order lines.
Revert debug value back to proper condition for hiding
the Can be Rented checkbox on service products.
…t domain

Enable editable bottom on rental order lines tree view.
Add invisible rental fields (rental, rental_type, can_sell_rental)
for onchange support. Replace product_uom_qty with rental_qty
column in the same position. Filter product dropdown on both
product_id and product_template_id to only show rental services.
…slation

Remove unused sale_order_line.py (empty class with no methods).
Add Catalan and Spanish translations for the Qty column label.
…tons

Add missing Catalan and Spanish translations for view strings
and field descriptions introduced by this module. Move Pickup
and Return buttons before Update Times button.
Add form view reference to Pickup and Return msgid entries
so Odoo matches the translation for the button labels.
…nish

Replace all "Devolución" with "Retorno" in Spanish translations
to avoid confusion with refunds. In the rental context, Return
means physically bringing back the rented items.
Add Catalan and Spanish translations for the Sale Start End Dates
module (fields, error messages, labels).
The OCA sale_rental module's rental_product_id_change onchange does not
initialize rental_qty when a rental product is selected. Since rental_qty
defaults to 0, the subsequent rental_qty_number_of_days_change computes
product_uom_qty as 0 * number_of_days = 0, overwriting Odoo's standard
default of 1. This fix sets rental_qty to 1 for new rentals so the
quantity behaves as expected.
Replace the onchange override with a simple field default, matching
the same pattern Odoo standard uses for product_uom_qty. The existing
onchange already resets rental_qty to 0 for non-rental products.
The field default approach does not work because the existing onchange
rental_product_id_change watches rental_qty and resets it to 0 when the
line is first created (product_id is empty). The onchange override sets
rental_qty to 1 only after a rental product is actually selected.
…ders

Allow changing rental_qty on confirmed rental orders (sale state),
matching how standard Odoo allows editing product_uom_qty after
confirmation. When rental_qty changes on a confirmed order:

- Recalculates product_uom_qty (rental_qty * number_of_days)
- Updates the rental stock moves (pickup and return) with the new qty
- Blocks changes if the pickup has already been completed

Also adds skip_procurement check to _action_launch_stock_rule to
prevent the OCA rental module from creating duplicate procurements
and sale.rental records when product_uom_qty is updated as a
consequence of rental_qty changes.
Clear qty_done on move lines before updating the move demand so that
the Done column on the picking resets to 0 instead of keeping the old
value.
…eliveries

Add a company-level setting "Require Signature to Validate Delivery" that,
when enabled, replaces the Validate button with a highlighted Sign button
on rental delivery pickings. Signing auto-validates the picking via
_attach_sign override with skip_immediate/skip_backorder context.

This only affects rental pickings when the setting is enabled — standard
Odoo picking workflow is completely unaffected. After auto-validation,
the Sign button hides (state=done). The setting includes the multi-company
icon (fa-building-o) for company-specific configuration.
…ckings

The sign-to-validate setting was hiding the Validate button on ALL rental
pickings (including returns/incoming). Now it only hides on outgoing
pickings (delivery), so return pickings keep their Validate button.
When a rental delivery order is signed, the generated PDF now displays
the rental signature terms (configured in Settings) next to the signature.
The conditions text appears on the left and the signature on the right,
so the signed document clearly states what the customer agreed to.

Non-rental pickings keep the original signature-only layout.
@eantones eantones merged commit aed24d9 into 16.0 Mar 23, 2026
13 checks passed
@eantones eantones deleted the 16.0-add-rental_base_extension branch March 23, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant